#!/usr/bin/env python

import gtk
import gobject

class specialTextView(gtk.TextView):
   __gsignals__ = dict(
      mykeypress = (gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION,
	                 None, # return type
	                 (str,)) # arguments
	)


gobject.type_register(specialTextView);

# Enter Handling
gtk.binding_entry_add_signal(specialTextView,gtk.keysyms.Return,0,
                             'mykeypress',str,'return');

gtk.binding_entry_add_signal(specialTextView,gtk.keysyms.KP_Enter,0,
                             'mykeypress',str,'return');

gtk.binding_entry_add_signal(specialTextView,gtk.keysyms.Return,
                             gtk.gdk.CONTROL_MASK,'mykeypress',str,
                             'ctrl+enter');

# Formatting Handling
gtk.binding_entry_add_signal(specialTextView,gtk.keysyms.B,
                             gtk.gdk.CONTROL_MASK,'mykeypress',
                             str,'ctrl+b'); # bold

gtk.binding_entry_add_signal(specialTextView,gtk.keysyms.I,
                             gtk.gdk.CONTROL_MASK,'mykeypress',
                             str,'ctrl+i'); # italic

gtk.binding_entry_add_signal(specialTextView,gtk.keysyms.U,
                             gtk.gdk.CONTROL_MASK,'mykeypress',
                             str,'ctrl+u'); # underline

gtk.binding_entry_add_signal(specialTextView,gtk.keysyms.H,
                             gtk.gdk.CONTROL_MASK,'mykeypress',
                             str,'ctrl+h'); # highlight